package com.example.androidmainshixun.view;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;

import com.example.androidmainshixun.R;

public class PersonalCenter extends AppCompatActivity implements View.OnClickListener {
    private ImageView mback;
    private Fragment mContentFragment;
    private FragmentManager mFragmentManager;
    private PerCenFrag perCenFrag;

    @SuppressLint("MissingInflatedId")
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.personal_center);
        mback = findViewById(R.id.back);

        initFragment();
        mFragmentManager.beginTransaction()
                .add(R.id.fragment_personal, perCenFrag).commitAllowingStateLoss();
        mContentFragment = perCenFrag;

        mback.setOnClickListener(this);
    }
    private void initFragment() {
        mFragmentManager = getSupportFragmentManager();
        perCenFrag = new PerCenFrag();
    }
    @Override
    public void onClick(View v) {
        int id = v.getId();
        if (id == R.id.back) {
            finish();
        }

    }
}

